﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Mobile_New_Register" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=2.0,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../New/css/index.css" />
    <link rel="stylesheet" type="text/css" href="../New/css/login.css" />

    <style type="text/css">
        * {
            margin: 0px;
            padding: 0px;
            list-style: none;
        }

        a:active {
            outline: hidden;
        }

        a, img, button, input, textarea {
            -webkit-tap-highlight-color: rgba(255,255,255,0);
        }

        .a_header {
            width: 100%;
            height: 50px;
            background: #fff;
            position: fixed;
            top: 0px;
            left: 0px;
            border-bottom: 1px solid #ddd;
        }

            .a_header .header_middle {
                width: 100%;
                height: 50px;
                line-height: 50px;
                text-align: center;
                font-size: 20px;
            }

            .a_header .a_header_l1 .h_l1 {
                width: 35px;
                height: 25px;
                background: url("../images/header_02.png") no-repeat;
                background-size: 10px 15px;
                margin: 16px 0px 0px 15px;
                position: absolute;
            }

            .a_header .a_header_l1 .h_l2 {
                width: 60px;
                height: 45px;
                position: fixed;
                left: 35px;
                top: 16px;
                color: #000;
                font-size: 14px;
            }

        body {
            background: #f0f0f0;
        }

        .content {
            /*padding-top: 51px;*/
        }

        .cont_footer .cont_footer_1_m {
            margin-top: 20px;
        }

        .cont_footer .cont_footer_1_n {
            width: 90%;
            text-align: center;
            background: #FC263E;
            border-radius: 6px;
            color: #FFFFFF;
            border: 1px solid #FC263E;
            margin: 0 auto;
            height: 30px;
            line-height: 30px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
        <div class="content">
            <div class="cont_middle">
                <div class="cont_middle_1">
                    <li>
                        <div class="co_mid_left">
                            <img src="../images/my_04.png" />
                        </div>
                    </li>
                    <li>
                        <div class="co_mid_right">
                            <input type="text" placeholder="请输入手机号" id="userPhone" />
                        </div>
                    </li>
                </div>

                <div class="cont_middle_1">
                    <li>
                        <div class="co_mid_left">
                            <img src="../images/my_06.png" />
                        </div>
                    </li>
                    <li>
                        <div class="co_mid_right">
                            <input type="password" placeholder="请输入密码" id="userPass" />
                        </div>
                    </li>
                </div>
                <div class="cont_middle_1">
                    <li>
                        <div class="co_mid_left">
                            <img src="../images/my_06.png" />
                        </div>
                    </li>
                    <li>
                        <div class="co_mid_right">
                            <input type="password" placeholder="请再次输入密码" id="userPass_2" />
                        </div>
                    </li>
                </div>

                <div class="cont_middle_1">
                    <li>
                        <div class="co_mid_left">
                            <img src="../images/my_123.png" />
                        </div>
                    </li>
                    <li>
                        <div class="co_mid_right">
                            <input type="text" placeholder="店主昵称" id="userName" />
                        </div>
                    </li>
                </div>
                <div class="cont_middle_1">
                    <li>
                        <div class="co_mid_left">
                            <img src="../images/my_041.png" />
                        </div>
                    </li>
                    <li>
                        <div class="co_mid_right">
                            <input type="text" placeholder="请送货地址" id="userAddress" />
                        </div>
                    </li>
                </div>
                <div style="border-bottom: 1px solid #ddd; width: 100%; padding: 0px 0px 40px 0px; margin: 0 auto; background: #fff; height: 15px">
                    <li>
                        <div style="width: 20%; float: left; margin-top: 15px">
                            <img style="height: 25px; padding-left: 20px;" src="../images/yanzhengma.png" />
                        </div>
                    </li>
                    <li>
                        <div style="width: 54%; float: left; margin-top: 20px;">
                            <input id="phonecode_a" style="width: 80%; color: #888; border: 0px; text-shadow: none; box-shadow: none; outline: none; border: none;" type="password" placeholder="请输入验证码" id="oldpsd" />
                        </div>
                        <div id="num_btn" style="float: left; height: 35px; width: 25%; background: #ccc; margin-top: 10px; text-align: center; line-height: 35px; color: #fff; border-radius: 7px; background: #FC263E; cursor: pointer">获取验证码</div>
                    </li>
                </div>
            </div>

            <div class="cont_footer">
                <div class="cont_footer_all">
                    <div class="cont_footer_1_m">
                        <div class="cont_footer_1_n" onclick="user_register();">
                            注册
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
<script type="text/javascript" src="../New/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../New/js/js.js"></script>
<script type="text/javascript">
    var numBtn = document.getElementById("num_btn");
    var timer = null;
    var second = 60;
    numBtn.onclick = function () {
        if (numBtn.innerHTML == "获取验证码") {
            numBtn.style.cssText += "background:#e1e1e1;color:#999;border-color:#ddd;";
            numBtn.innerHTML = Number(parseInt(second / 600 % 10)).toString() + parseInt(second / 60 % 10) + ":" + Number(parseInt(second % 60 / 10)).toString() + (second % 10);
            phonecode();
            timer = setInterval(function () {
                second--;
                if (second == 0) {
                    numBtn.style.cssText += "background:#c81624;color:#FFFFFF;border-color:#c81624;";
                    numBtn.innerHTML = "获取验证码";
                    second = 60;
                    clearInterval(timer);
                }
                else {
                    numBtn.innerHTML = Number(parseInt(second / 600 % 10)).toString() + parseInt(second / 60 % 10) + ":" + Number(parseInt(second % 60 / 10)).toString() + (second % 10);
                }
            }, 1000);
        }
        //}
    };

    function phonecode() {
        var phone = $("#userPhone").val();

        $.ajax({
            url: "program/operate.ashx",
            data: { a: "phonecode_register", phone: phone },
            cache: false,
            error: function () {
                alert("error");
            },
            success: function (result) {
                //alert(result);
            }
        });
    }

    function user_register() {
        var userPhone = $("#userPhone").val();
        var userPass = $("#userPass").val();
        var userPass_2 = $("#userPass_2").val();
        var userName = $("#userName").val();
        var userAddress = $("#userAddress").val();
        var phoneCode = $("#phonecode_a").val();

        $.ajax({
            url: "program/operate.ashx",
            data: {
                a: "register",
                userPhone: userPhone,
                userPass: userPass,
                userPass_2: userPass_2,
                userName: userName,
                userAddress: userAddress,
                phoneCode: phoneCode
            },
            cache: false,
            error: function () {
                alert("ajax error");
            },
            success: function (result) {

                if (result == "ok") {
                    location.href = "Default.aspx?pageid=zhounianqing"
                }
                else {
                    alert(result);
                }

            }
        })
    }
</script>


</html>
